home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13836 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  56 lines

  1. Newsgroups: comp.lang.c
  2. Path: phcoms4.seri.philips.nl!newssvr!news
  3. From: niessene <niessene@natlab.research.philips.com>
  4. Subject: Mouse Event Handler
  5. Sender: news@natlab.research.philips.com (USENET News System)
  6. Message-ID: <316B59B1.359D@natlab.research.philips.com>
  7. Date: Wed, 10 Apr 1996 06:48:17 GMT
  8. Content-Transfer-Encoding: 7bit
  9. Content-Type: text/plain; charset=us-ascii
  10. Mime-Version: 1.0
  11. X-Mailer: Mozilla 2.0 (X11; I; HP-UX A.09.05 9000/735)
  12. Organization: Philips Research Laboratories
  13.  
  14. Can somebody tell me why the following programm doesn't work?
  15. It only goes one time in the ISR. I'm using Borland C++ 4.5.
  16.  
  17. #include <stdio.h>
  18. #include <dos.h>
  19. #include <conio.h>
  20.  
  21. void interrupt far nieuwint33() {
  22.  sound(1500);
  23.  delay(10);
  24.  nosound();  }
  25.  
  26. void main()  {
  27.   union REGS reg;
  28.   struct SREGS sreg;
  29.   int oldmask;
  30.   void * oldhandler;
  31.  
  32. // reset mouse
  33.   reg.x.ax=0;
  34.   int86(0x33, ®, ®);
  35.  
  36. // swap event handler
  37.   reg.x.ax=20;
  38.   reg.x.cx=1;
  39.   sreg.es=FP_SEG(nieuwint33);
  40.   reg.x.dx=FP_OFF(nieuwint33);
  41.   int86x(0x33, ®, ®, &sreg);
  42.   oldmask=reg.x.cx;
  43.   oldhandler=MK_FP(sreg.es, reg.x.dx);
  44.  
  45.   clrscr();
  46.   do {}
  47.   while (!kbhit());
  48.  
  49. // swapevent handler
  50.   reg.x.ax=20;
  51.   reg.x.cx=oldmask;
  52.   sreg.es=FP_SEG(oldhandler);
  53.   reg.x.dx=FP_OFF(oldhandler);
  54.   int86x(0x33, ®, ®, &sreg);
  55. }
  56.